package model.service;

import java.util.List;

import model.dao.IParticipanteDAO;
import model.entity.Participante;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 
 * Participante Service
 * 
 * @author Alex
 * 
 */
@Service(value = "participanteService")
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class ParticipanteService implements IParticipanteService {

	// ParticipanteDAO is injected...
	@Autowired
	IParticipanteDAO participanteDAO;

	/**
	 * Add Participante
	 * 
	 * @param Participante
	 *            participante
	 */
	@Transactional(readOnly = false)
	@Override
	public void addParticipante(Participante participante) {
		getParticipanteDAO().addParticipante(participante);
	}

	/**
	 * Delete Participante
	 * 
	 * @param Participante
	 *            participante
	 */
	@Transactional(readOnly = false)
	@Override
	public void deleteParticipante(Participante participante) {
		getParticipanteDAO().deleteParticipante(participante);
	}

	/**
	 * Update Participante
	 * 
	 * @param Participante
	 *            participante
	 */
	@Transactional(readOnly = false)
	@Override
	public void updateParticipante(Participante participante) {
		getParticipanteDAO().updateParticipante(participante);
	}

	/**
	 * Get Participante
	 * 
	 * @param int Participante Id
	 */
	@Override
	public Participante getParticipanteByEmail(String email) {
		return getParticipanteDAO().getParticipanteByEmail(email);
	}

	/**
	 * Get Participante List
	 * 
	 */
	@Override
	public List<Participante> getParticipantes() {
		return getParticipanteDAO().getParticipantes();
	}

	/**
	 * Get Participante DAO
	 * 
	 * @return IParticipanteDAO - Participante DAO
	 */
	public IParticipanteDAO getParticipanteDAO() {
		return participanteDAO;
	}

	/**
	 * Set Participante DAO
	 * 
	 * @param IParticipanteDAO
	 *            - Participante DAO
	 */
	public void setParticipanteDAO(IParticipanteDAO participanteDAO) {
		this.participanteDAO = participanteDAO;
	}
}
